Galaxy Morphology with galamoยถ
Welcome to the tutorial on using galamo, a Python package designed for comprehensive galaxy analysis.
Abstract: In this tutorial, we'll explore the galaxy_morph module that helps in classifying galaxy types on the basis of initial photometric data of the galaxies. galaxy_morph works on deep learning model trained on 70000 SDSS and HST galaxies data using Custom CNN and Decision tree as per guidelines of galaxy-zoo making the hybrid model.
Classification Labels:
0: ("Merger Galaxy", "Disturbed Galaxy"),
1: ("Merger Galaxy", "Merging Galaxy"),
2: ("Elliptical Galaxy", "Round Smooth Galaxy"),
3: ("Elliptical Galaxy", "In-between Round Smooth Galaxy"),
4: ("Elliptical Galaxy", "Cigar Shaped Smooth Galaxy"),
5: ("Spiral Galaxy", "Barred Spiral Galaxy"),
6: ("Spiral Galaxy", "Unbarred Tight Spiral Galaxy"),
7: ("Spiral Galaxy", "Unbarred Loose Spiral Galaxy"),
8: ("Spiral Galaxy", "Edge-on Galaxy without Bulge"),
9: ("Spiral Galaxy", "Edge-on Galaxy with Bulge")
This module is especially useful for astrophysics researchers and students working with galaxy morphology in oprtical wavelengths from surveys like SDSS, HST, etc.
Keywords: galaxy_morph, CNN, galamo
Author: Jashanpreet Singh Dingra
References:
Letโs get started!
!pip install galamo
!pip show galamo #check requirements
Name: galamo Version: 1.1.2 Summary: An open source Python package for comprehensive galaxy analysis, integrating machine learning and statistical methods. It provides automated tools for morphology classification, kinematics, photometry, and spectral analysis to aid astrophysical research. Home-page: https://www.galamo.org Author: Jashanpreet Singh Dingra Author-email: astrodingra@gmail.com License: Location: /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages Requires: huggingface_hub, joblib, matplotlib, numpy, opencv-python, pandas, requests, scipy, tensorflow, termcolor, tqdm Required-by:
Predicting for single imageยถ
from galamo import galaxy_morph as gm # import
gm("ngc99.jpg")
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR I0000 00:00:1756585766.438921 16427730 pluggable_device_factory.cc:305] Could not identify NUMA node of platform GPU ID 0, defaulting to 0. Your kernel may not have been built with NUMA support. I0000 00:00:1756585766.439283 16427730 pluggable_device_factory.cc:271] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 0 MB memory) -> physical PluggableDevice (device: 0, name: METAL, pci bus id: <undefined>)
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Prediction Initialized โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ Found 1 image(s). Starting prediction... โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
๐ Processing Images: 0%| | 0/1 [00:00<?, ?image/s]
๐ Processing Images: 100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 1/1 [00:00<00:00, 2.61image/s]
๐ Galaxy Morphology Prediction Results โโโโโโโโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโณโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ Filename โ Type โ Confidence (%) โ Subclass โ โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ โ ngc99.jpg โ Galaxy โ 95.02 โ Unbarred Loose Spiral Galaxy โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโดโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Predicting Galaxies morphology in Bulkยถ
from galamo import galaxy_morph as gm
gm("galaxies/")
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Prediction Initialized โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ Found 5 image(s). Starting prediction... โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
๐ Processing Images: 0%| | 0/5 [00:00<?, ?image/s]
๐ Processing Images: 20%|โโโโโโโโโโโโ | 1/5 [00:00<00:00, 4.44image/s]
๐ Processing Images: 60%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | 3/5 [00:00<00:00, 7.29image/s]
๐ Processing Images: 100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 5/5 [00:00<00:00, 8.14image/s]
๐ Galaxy Morphology Prediction Results โโโโโโโโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ Filename โ Type โ Confidence (%) โ Subclass โ โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ โ NGC4676.jpg โ Galaxy โ 99.57 โ Cigar Shaped Smooth Galaxy โ โ images-agn.jpeg โ Galaxy โ 99.14 โ Merging Galaxy โ โ ngc99.jpg โ Galaxy โ 95.02 โ Unbarred Loose Spiral Galaxy โ โ red-apple.jpg โ Not a Galaxy โ 100.00 โ - โ โ sdssdr14.png โ Galaxy โ 99.77 โ Barred Spiral Galaxy โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Saving the results in CSV formatยถ
from galamo import galaxy_morph as gm
gm("galaxies/")
gm.save_csv('results.csv')
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Prediction Initialized โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ Found 5 image(s). Starting prediction... โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
๐ Processing Images: 0%| | 0/5 [00:00<?, ?image/s]
๐ Processing Images: 20%|โโโโโโโโโโโโ | 1/5 [00:00<00:00, 4.54image/s]
๐ Processing Images: 60%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | 3/5 [00:00<00:00, 7.11image/s]
๐ Processing Images: 100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 5/5 [00:00<00:00, 8.05image/s]
๐ Galaxy Morphology Prediction Results โโโโโโโโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ Filename โ Type โ Confidence (%) โ Subclass โ โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ โ NGC4676.jpg โ Galaxy โ 99.57 โ Cigar Shaped Smooth Galaxy โ โ images-agn.jpeg โ Galaxy โ 99.14 โ Merging Galaxy โ โ ngc99.jpg โ Galaxy โ 95.02 โ Unbarred Loose Spiral Galaxy โ โ red-apple.jpg โ Not a Galaxy โ 100.00 โ - โ โ sdssdr14.png โ Galaxy โ 99.77 โ Barred Spiral Galaxy โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
For any issue in the module raise @ https://github.com/galamo-org/galamo/issues